
const origin = [
  // { image: 'refill', text: '充值', url: 'refill'},
  { image: 'qrcode', text: '推荐码', url: 'qr-code' },
  // { image: 'sign-in', text: '签到', url: 'sign-in' },
  { image: 'team', text: '我的团队', url: 'team' },
  { image: 'commission', text: '我的佣金', url: 'commission' },
  // { image: 'identity-card', text: '业绩', url: 'performance' },
  { image: 'cash', text: '提现管理', url: 'cash' },
  // { image: 'group', text: '我的拼团', url: 'group/0' },
  { image: 'password', text: '支付密码', url: 'pay-password' },
  { image: 'bank', text: '默认银行卡', url: 'bank' },
  { image: 'address', text: '地址管理', url: 'address-list' },
  // { image: 'group', text: '申请区代', url: 'area-reg' },
]

Component({
  properties: {
    is_area: {
      type: Boolean,
      default: false,
      observer(newVal, oldVal, changedPath) {
        // console.log(newVal, 1111111)
        if (newVal) {
          const list = [...origin]
          // list.push({ image: 'group', text: '申请区代', url: 'area-reg' })
          this.setData({
            list
          })
        } else {
          this.setData({
            list: [...origin]
          })
        }
      }
    }
  },
  data: {
    list: [...origin]
  },
  methods: {
    handleClick(event) {
      const item = event.currentTarget.dataset.item
      const url = item.url

      if (url == 'area-reg') {
        this.triggerEvent('regArea')
      } else {
        wx.navigateTo({
          url: `/sub_service/pages/${url}/index`
        })
      }
    }
  }
});
